package com.openvid.webrtc.openvid.cmd.ice_candidate;

import com.openvid.webrtc.openvid.cmd.AbsRequestCmd;

/**
 * @author jinyf
 */
public class CmdIceCandidate extends AbsRequestCmd<RespIceCandidate> {

    private ParamsIceCandidate mParams = new ParamsIceCandidate();

    private String mEndPointName;
    private String mCandidate;
    private String mSdpMid;
    private int mSdpMLineIndex;

    @Override
    protected String getMethodName() {
        return "onIceCandidate";
    }


    public void setParams(String mEndPointName, String mCandidate, String mSdpMid, int mSdpMLineIndex) {
        this.mEndPointName = mEndPointName;
        this.mCandidate = mCandidate;
        this.mSdpMid = mSdpMid;
        this.mSdpMLineIndex = mSdpMLineIndex;
    }

    @Override
    protected Object getParams() {

        if (mEndPointName != null) {
            mParams.endpointName = mEndPointName;
        }
        mParams.candidate = mCandidate;
        mParams.sdpMid = mSdpMid;
        mParams.sdpMLineIndex = Integer.toString(mSdpMLineIndex);

        return mParams;
    }

    @Override
    protected Class<RespIceCandidate> getResponseClass() {
        return RespIceCandidate.class;
    }
}
